let ajax = (config) => {
    let xhr = new XMLHttpRequest();
    xhr.open(config.method = 'get', config.url, true);
    xhr.onreadystatechange = () => {
        if(xhr.readyState === 4) {
            if(xhr.status === 200) {
                config.success(JSON.parse(xhr.responseText));
            }else{
                config.fail(xhr.status)
            }
        }
    };
    xhr.send();
};